import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 班级物品信息 */
export interface ClassAsset {
  id: number // 编号
  name?: string // 物品名称
  sort?: number // 排序
  status?: number // 状态
}

// 班级物品 API
export const ClassAssetApi = {
  // 查询班级物品分页
  getClassAssetPage: async (params: any) => {
    return await request.get({ url: `/school/class-asset/page`, params })
  },

  // 查询班级物品详情
  getClassAsset: async (id: number) => {
    return await request.get({ url: `/school/class-asset/get?id=` + id })
  },
  // 根据月份查询班级物品-查询每个月物品
  getScheduleByMonth: async (params: any) => {
    return await request.get({ url: `/school/class-handover/get-by-month`, params })
  },
  // 新增班级物品
  createClassAsset: async (data: ClassAsset) => {
    return await request.post({ url: `/school/class-asset/create`, data })
  },

  // 修改班级物品
  updateClassAsset: async (data: ClassAsset) => {
    return await request.put({ url: `/school/class-asset/update`, data })
  },

  // 删除班级物品
  deleteClassAsset: async (id: number) => {
    return await request.delete({ url: `/school/class-asset/delete?id=` + id })
  },

  /** 批量删除班级物品 */
  deleteClassAssetList: async (ids: number[]) => {
    return await request.delete({ url: `/school/class-asset/delete-list?ids=${ids.join(',')}` })
  },

  // 导出班级物品 Excel
  exportClassAsset: async (params) => {
    return await request.download({ url: `/school/class-asset/export-excel`, params })
  }
}
